define(function(require, exports, module) {
    var ALL = require("../../common/all"),
        CONFIG = ALL.CONFIG,
        METHOD = ALL.METHOD,
        Dialog = ALL.Dialog,
        Init = ALL.Init;

    var _Dialog = new Dialog({
        title : "提示",
        content : "<p>确定是否提交？</p>",
        text4Btn: ["确定", "取消"],
        class4Btn: ["", "line"]
    });

    var _vm = Init.initVue({
        data : {
            check: {},
            res: {
                type : '',
                user_no : '',
                user_id : '',
                user_name : '',
                trade_no : '',
                card_no : '',
                amount : '',
                remark : '',
            }
        },
        methods: {
            submit : function() {
                var url, flag;

                this.check.$valid();
                flag = this.check.flag;

                if (!flag) { return; }

                if (_vm.res.type == 1) {
                    url = "asset/manual/deposit";
                } eles {
                    url = "asset/manual/withdraw";
                }

                _Dialog.showUI(function(i) {
                    if (i == 0) {
                        METHOD.loading.show();
                        METHOD.ajax(url,_vm.res,{type : 'post'}).done(function(){
                            METHOD.alert("操作成功").done(function(){
                                window.location.href = "../finance/manual.html";
                            });
                            METHOD.loading.hide();
                        }).fail(function(){
                            METHOD.loading.hide();
                        });
                    }
                    this.hideUI();
                });
            },
            getInfoCallback : function(o) {
                if (o) {
                    this.res.user_id = o.id;
                    this.res.user_name = o.name;
                } else {
                    this.res.user_id = "";
                    this.res.user_name = "";
                }
            }
        }
    });

    var type = METHOD.getQueryParms("type");
    if (type == 'out') {
        _vm.res.type = 2;
    } else {
        _vm.res.type = 1;
    }


});

